package com.ayu.shortlink.admin.controller;

import com.ayu.shortlink.admin.common.convention.result.Result;
import com.ayu.shortlink.admin.remote.dto.ShortLinkActualRemoteService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 根据Url获取文章标题控制层
 */
@RestController(value = "urlTitleControllerByAdmin")
@RequiredArgsConstructor
public class UrlTitleController {

    private final ShortLinkActualRemoteService shortLinkActualRemoteService;

    /**
     * 获取url标题
     */
    @GetMapping("/api/short-link/admin/v1/title")
    public Result<String> getLinkTitle(@RequestParam("url") String requestParam){
        return shortLinkActualRemoteService.getLinkTitle(requestParam);
    }
}
